<?php
abstract class Payment{
	abstract function pay();
} 

class AliPay extends Payment{
	
	public function pay(){
		echo 'aliPay支付<br/>';	
	}
	
	public function pay1(){
		echo 'aliPay1支付<br/>';
	}
}

class WxPay extends Payment{
	
	public function pay(){
		echo '微信支付<br/>';	
	}
	public function pay1(){
		echo '微信支付1<br/>';
	}
}

abstract class Factory{
	abstract public function payAction();
}

class AlipayFactory extends Factory{
	public function payAction(){
		return new Alipay();
	}
}

class WxPayFactory extends Factory{
	public function payAction(){
		return new WxPay();
	}
}

$factory = new AlipayFactory();
$alipay = $factory->payAction();
$alipay->pay();

$factory = new WxPayFactory();
$wxpay = $factory->payAction();
$wxpay->pay();
?>